import { createRouter, createWebHistory,RouteRecordRaw } from 'vue-router';
import Login from "../views/Login.vue"
import Home from "../views/Home.vue"

const routes: Array<RouteRecordRaw> = [
    {
        path:'/',
        name:'Index',
        component: () => import('../views/Index.vue')
    },
    {
        path: '/login',
        component: Login
    },
    {
      path:'/login',
      name:'Login',
      component: () => import('../views/LoginRegister.vue')
    },
    {
        path:'/:catchAll(.*)',
        name:'404',
        component:() => import('../views/LoginRegister.vue')
    },
    {
        path: '/home',
        component: Home,
        beforeEnter: (to, from, next) => {
            console.log(123);
            
        }
    }
]
const router = createRouter({
    routes,
    // 路由模式
    history: createWebHistory(process.env.BASE_URL)
})

export default router
